﻿using System;
using System.IO;
using System.Windows.Forms;
using Styx.Common;
using Styx.CommonBot;

namespace TuanHA_Monk
{
    public partial class THForm : Form
    {
        public THForm()
        {
            InitializeComponent();
        }

        private void THForm_Load(object sender, EventArgs e)
        {
            #region DataGridView

            //DataGridView Debuff to Cleanse ASAP
            dvCleanseASAP.DataSource = THSettings.Instance.DsCleanseASAP;
            dvCleanseASAP.DataMember = "data";
            dvCleanseASAP.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
            dvCleanseASAP.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            #endregion

            THSettings.Instance.Load();

            if (
                File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAMonk\TuanHA-Monk-Picture.jpg"))
            {
                pictureBox1.ImageLocation = Utilities.AssemblyDirectory +
                                            @"\Routines\TuanHAMonk\TuanHA-Monk-Picture.jpg";
            }

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAMonk\SpecialThanks.rtf"))
            {
                richTextBox1.LoadFile(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAMonk\SpecialThanks.rtf");
            }

            #region Spells

            SRoll.Checked = THSettings.Instance.SRoll;
            SFSK.Checked = THSettings.Instance.SFSK;
            SProvoke.Checked = THSettings.Instance.SProvoke;
            SSummonBlackOxStatue.Checked = THSettings.Instance.SSummonBlackOxStatue;
            SLeeroftheOx.Checked = THSettings.Instance.SLeeroftheOx;
            SClash.Checked = THSettings.Instance.SClash;
            SSpearHandStrike.Checked = THSettings.Instance.SSpearHandStrike;
            SDizzyingHaze.Checked = THSettings.Instance.SDizzyingHaze;
            SGuard.Checked = THSettings.Instance.SGuard;
            SSpinningCraneKick.Value = THSettings.Instance.SSpinningCraneKick;
            SXuen.Checked = THSettings.Instance.SXuen;
            STouchofDeath.Checked = THSettings.Instance.STouchofDeath;
            SBuff.Checked = THSettings.Instance.SBuff;
            SFood.Value = new decimal(THSettings.Instance.SFood);
            SAutoTarget.Checked = THSettings.Instance.SAutoTarget;
            SMoveToTarget.Checked = THSettings.Instance.SMoveToTarget;

            SPending.Value = new decimal(THSettings.Instance.SPending);

            SStrafleLeft.SelectedIndex = THSettings.Instance.SStrafleLeft;
            SForward.SelectedIndex = THSettings.Instance.SForward;
            SStrafleRight.SelectedIndex = THSettings.Instance.SStrafleRight;
            STurnRight.SelectedIndex = THSettings.Instance.STurnRight;
            SBackward.SelectedIndex = THSettings.Instance.SBackward;
            STurnLeft.SelectedIndex = THSettings.Instance.STurnLeft;

            SLifeCocoon.Value = new decimal(THSettings.Instance.SLifeCocoon);
            SEnvelopingMist.Value = new decimal(THSettings.Instance.SEnvelopingMist);
            SSurgingMist.Value = new decimal(THSettings.Instance.SSurgingMist);
            SRenewingMist.Value = new decimal(THSettings.Instance.SRenewingMist);
            SSoothingMist.Value = new decimal(THSettings.Instance.SSoothingMist);
            SUplift.Value = new decimal(THSettings.Instance.SUplift);
            SUpliftMinUnit.Value = new decimal(THSettings.Instance.SUpliftMinUnit);
            SChiBurstHeal.Value = new decimal(THSettings.Instance.SChiBurstHeal);
            SChiBurstHealUnit.Value = new decimal(THSettings.Instance.SChiBurstHealUnit);
            SZenSphere.Value = new decimal(THSettings.Instance.SZenSphere);
            SChiWave.Value = new decimal(THSettings.Instance.SChiWave);
            SChiTorpedoUnit.Value = new decimal(THSettings.Instance.SChiTorpedoUnit);
            SChiTorpedo.Value = new decimal(THSettings.Instance.SChiTorpedo);
            SSpinCraneKickHealUnit.Value = new decimal(THSettings.Instance.SSpinCraneKickHealUnit);
            SSpinCraneKickHeal.Value = new decimal(THSettings.Instance.SSpinCraneKickHeal);
            SJabChi.Value = new decimal(THSettings.Instance.SJabChi);
            SThunderFocusUnit.Value = new decimal(THSettings.Instance.SThunderFocusUnit);
            SSummonJadeSerpentStatue.Checked = THSettings.Instance.SSummonJadeSerpentStatue;

            SFortifyingBrew.Value = new decimal(THSettings.Instance.SFortifyingBrew);
            SAvertHamUnit.Value = new decimal(THSettings.Instance.SAvertHamUnit);
            SAvertHam.Value = new decimal(THSettings.Instance.SAvertHam);
            SZenMedUnit.Value = new decimal(THSettings.Instance.SZenMedUnit);
            SZenMed.Value = new decimal(THSettings.Instance.SZenMed);
            SRevive.Value = new decimal(THSettings.Instance.SRevival);
            SReviveUnit.Value = new decimal(THSettings.Instance.SRevivalUnit);

            SDetox.Checked = THSettings.Instance.SDetox;
            SDetoxDebuffNumber.Value = new decimal(THSettings.Instance.SDetoxDebuffNumber);

            SGroup1.Checked = THSettings.Instance.SGroup1;
            SGroup2.Checked = THSettings.Instance.SGroup2;
            SGroup3.Checked = THSettings.Instance.SGroup3;
            SGroup4.Checked = THSettings.Instance.SGroup4;
            SGroup5.Checked = THSettings.Instance.SGroup5;
            SGroup6.Checked = THSettings.Instance.SGroup6;
            SGroup7.Checked = THSettings.Instance.SGroup7;
            SGroup8.Checked = THSettings.Instance.SGroup8;
            #endregion
        }


        private void bOK_Click(object sender, EventArgs e)
        {
            MessageBox.Show("TuanHA Monk Settings have been saved", "Save");
            THSettings.Instance.Save();
            Logging.Write("----------------------------------");
            Logging.Write("TuanHA Monk Settings have been saved");
            Close();

            THSettings.Instance.UpdateStatus = true;
        }

        private void bGeneral_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabPage2;

            MessageBox.Show("Full AFK Mode: Work best with ArcheologyBuddy, DungeonBuddy, Grind Bot, Questing...",
                            "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Full AFK Mode On");
            Logging.Write("----------------------------------");

            SRoll.CheckState = CheckState.Unchecked;
            SFSK.CheckState = CheckState.Unchecked;
            SProvoke.CheckState = CheckState.Checked;
            SSummonBlackOxStatue.CheckState = CheckState.Checked;
            SLeeroftheOx.CheckState = CheckState.Checked;
            SClash.CheckState = CheckState.Checked;
            SSpearHandStrike.CheckState = CheckState.Checked;
            SDizzyingHaze.CheckState = CheckState.Checked;
            SGuard.CheckState = CheckState.Checked;
            SSpinningCraneKick.Value = 3;
            SXuen.CheckState = CheckState.Checked;
            STouchofDeath.CheckState = CheckState.Checked;
            SBuff.CheckState = CheckState.Checked;
            SFood.Value = 60;
            SAutoTarget.CheckState = CheckState.Checked;
            SMoveToTarget.CheckState = CheckState.Checked;

            SPending.Value = 1000;

            SLifeCocoon.Value = 30;
            SEnvelopingMist.Value = 80;
            SSurgingMist.Value = 60;
            SRenewingMist.Value = 95;
            SSoothingMist.Value = 80;
            SUplift.Value = 95;
            SUpliftMinUnit.Value = 3;
            SChiBurstHeal.Value = 95;
            SChiBurstHealUnit.Value = 3;
            SZenSphere.Value = 95;
            SChiWave.Value = 95;
            SChiTorpedoUnit.Value = 3;
            SChiTorpedo.Value = 95;
            SSpinCraneKickHealUnit.Value = 3;
            SSpinCraneKickHeal.Value = 95;
            SJabChi.Value = 0;
            SThunderFocusUnit.Value = 3;
            SSummonJadeSerpentStatue.CheckState = CheckState.Checked;

            SFortifyingBrew.Value = 40;
            SAvertHamUnit.Value = 3;
            SAvertHam.Value = 60;
            SZenMedUnit.Value = 3;
            SZenMed.Value = 40;
            SRevive.Value = 60;
            SReviveUnit.Value = 3;

            SDetox.CheckState = CheckState.Checked;
            SDetoxDebuffNumber.Value = 3;
        }

        private void bDungeon_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabPage2;

            MessageBox.Show(
                "Dungeon Mode: Work best with LazyRaider in Dungeon.\r\n\r\nMistweaver use faster heal logic that take more of mana.",
                "Important Note",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Dungeon Mode On");
            Logging.Write("----------------------------------");

            if (SpellManager.HasSpell("Stance of the Wise Serpent"))
            {
                SSpearHandStrike.CheckState = CheckState.Unchecked;
                SFood.Value = 60;
            }
            else
            {
                SSpearHandStrike.CheckState = CheckState.Checked;
                SFood.Value = 0;
            }

            SRoll.CheckState = CheckState.Unchecked;
            SFSK.CheckState = CheckState.Unchecked;
            SProvoke.CheckState = CheckState.Checked;
            SSummonBlackOxStatue.CheckState = CheckState.Checked;
            SLeeroftheOx.CheckState = CheckState.Checked;
            SClash.CheckState = CheckState.Checked;
            SDizzyingHaze.CheckState = CheckState.Checked;
            SGuard.CheckState = CheckState.Checked;
            SSpinningCraneKick.Value = 3;
            SXuen.CheckState = CheckState.Checked;
            STouchofDeath.CheckState = CheckState.Checked;
            SBuff.CheckState = CheckState.Checked;
            SAutoTarget.CheckState = CheckState.Checked;
            SMoveToTarget.CheckState = CheckState.Unchecked;

            SPending.Value = 1000;

            SSpinningCraneKick.Value = 3;
            SXuen.CheckState = CheckState.Checked;
            SMoveToTarget.CheckState = CheckState.Unchecked;


            SLifeCocoon.Value = 30;
            SEnvelopingMist.Value = 80;
            SSurgingMist.Value = 40;
            SRenewingMist.Value = 95;
            SSoothingMist.Value = 80;
            SUplift.Value = 95;
            SUpliftMinUnit.Value = 3;
            SChiBurstHeal.Value = 95;
            SChiBurstHealUnit.Value = 3;
            SZenSphere.Value = 95;
            SChiWave.Value = 95;
            SChiTorpedoUnit.Value = 3;
            SChiTorpedo.Value = 95;
            SSpinCraneKickHealUnit.Value = 3;
            SSpinCraneKickHeal.Value = 95;
            SJabChi.Value = 0;
            SThunderFocusUnit.Value = 3;
            SSummonJadeSerpentStatue.CheckState = CheckState.Checked;

            SFortifyingBrew.Value = 40;
            SAvertHamUnit.Value = 3;
            SAvertHam.Value = 60;
            SZenMedUnit.Value = 3;
            SZenMed.Value = 40;
            SRevive.Value = 60;
            SReviveUnit.Value = 3;

            SDetox.CheckState = CheckState.Checked;
            SDetoxDebuffNumber.Value = 3;

        }

        private void bRaid_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabPage2;

            MessageBox.Show(
                "Raid Mode: Work best with LazyRaider in Raiding.\r\n\r\nMistweaver use lower heal logic to save mana.",
                "Important Note",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Raid Mode On");
            Logging.Write("----------------------------------");

            if (SpellManager.HasSpell("Stance of the Wise Serpent"))
            {
                SFood.Value = 60;
                SAutoTarget.CheckState = CheckState.Checked;
            }
            else
            {
                SFood.Value = 0;
                SAutoTarget.CheckState = CheckState.Unchecked;
            }

            SSpearHandStrike.CheckState = CheckState.Unchecked;
            SRoll.CheckState = CheckState.Unchecked;
            SFSK.CheckState = CheckState.Unchecked;
            SProvoke.CheckState = CheckState.Unchecked;
            SSummonBlackOxStatue.CheckState = CheckState.Checked;
            SLeeroftheOx.CheckState = CheckState.Unchecked;
            SClash.CheckState = CheckState.Checked;
            SDizzyingHaze.CheckState = CheckState.Checked;
            SGuard.CheckState = CheckState.Checked;
            SSpinningCraneKick.Value = 3;
            SXuen.CheckState = CheckState.Unchecked;
            STouchofDeath.CheckState = CheckState.Checked;
            SBuff.CheckState = CheckState.Checked;
            SMoveToTarget.CheckState = CheckState.Unchecked;

            SPending.Value = 1000;

            SSpinningCraneKick.Value = 3;
            SXuen.CheckState = CheckState.Checked;

            SLifeCocoon.Value = 20;
            SEnvelopingMist.Value = 60;
            SSurgingMist.Value = 30;
            SRenewingMist.Value = 95;
            SSoothingMist.Value = 80;
            SUplift.Value = 90;
            SUpliftMinUnit.Value = 4;
            SChiBurstHeal.Value = 80;
            SChiBurstHealUnit.Value = 4;
            SZenSphere.Value = 95;
            SChiWave.Value = 95;
            SChiTorpedoUnit.Value = 3;
            SChiTorpedo.Value = 95;
            SSpinCraneKickHealUnit.Value = 5;
            SSpinCraneKickHeal.Value = 90;
            SJabChi.Value = 0;
            SThunderFocusUnit.Value = 6;
            SSummonJadeSerpentStatue.CheckState = CheckState.Checked;

            SFortifyingBrew.Value = 40;
            SAvertHamUnit.Value = 6;
            SAvertHam.Value = 60;
            SZenMedUnit.Value = 6;
            SZenMed.Value = 40;
            SRevive.Value = 60;
            SReviveUnit.Value = 6;

            SDetox.CheckState = CheckState.Checked;
            SDetoxDebuffNumber.Value = 3;
        }

        private void bPvP_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabPage2;

            MessageBox.Show(
                "PvP Mode: Work best with LazyRaider in PvP.\r\n\r\nMistweaver use fastest heal logic that take a lot of mana.",
                "Important Note", MessageBoxButtons.OK,
                MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("PvP Mode On");
            Logging.Write("----------------------------------");

            SRoll.CheckState = CheckState.Checked;
            SFSK.CheckState = CheckState.Checked;
            SProvoke.CheckState = CheckState.Checked;
            SSummonBlackOxStatue.CheckState = CheckState.Checked;
            SLeeroftheOx.CheckState = CheckState.Checked;
            SClash.CheckState = CheckState.Checked;
            SSpearHandStrike.CheckState = CheckState.Checked;
            SDizzyingHaze.CheckState = CheckState.Checked;
            SGuard.CheckState = CheckState.Checked;
            SSpinningCraneKick.Value = 3;
            SXuen.CheckState = CheckState.Checked;
            STouchofDeath.CheckState = CheckState.Checked;
            SBuff.CheckState = CheckState.Checked;
            SFood.Value = 60;
            SAutoTarget.CheckState = CheckState.Checked;
            SMoveToTarget.CheckState = CheckState.Unchecked;

            SPending.Value = 1000;

            SLifeCocoon.Value = 40;
            SEnvelopingMist.Value = 80;
            SSurgingMist.Value = 70;
            SRenewingMist.Value = 95;
            SSoothingMist.Value = 80;
            SUplift.Value = 95;
            SUpliftMinUnit.Value = 3;
            SChiBurstHeal.Value = 95;
            SChiBurstHealUnit.Value = 3;
            SZenSphere.Value = 95;
            SChiWave.Value = 95;
            SChiTorpedoUnit.Value = 3;
            SChiTorpedo.Value = 95;
            SSpinCraneKickHealUnit.Value = 3;
            SSpinCraneKickHeal.Value = 95;
            SJabChi.Value = 4;
            SThunderFocusUnit.Value = 3;
            SSummonJadeSerpentStatue.CheckState = CheckState.Checked;

            SFortifyingBrew.Value = 40;
            SAvertHamUnit.Value = 3;
            SAvertHam.Value = 60;
            SZenMedUnit.Value = 3;
            SZenMed.Value = 40;
            SRevive.Value = 60;
            SReviveUnit.Value = 3;

            SDetox.CheckState = CheckState.Checked;
            SDetoxDebuffNumber.Value = 3;
        }

        private void bLazyRaiderPlus_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabPage2;

            MessageBox.Show(
                "Quest Helper Mode: Work best with LazyRaider in solo questing.\r\n\r\nFor use with Zigor (http://www.zygorguides.com/) Just select your target, the bot will move to melee range and attack.\r\n\r\nRemember disable plugin Glue.",
                "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Quest Helper Mode On");
            Logging.Write("----------------------------------");


            SRoll.CheckState = CheckState.Checked;
            SFSK.CheckState = CheckState.Checked;
            SProvoke.CheckState = CheckState.Checked;
            SSummonBlackOxStatue.CheckState = CheckState.Checked;
            SLeeroftheOx.CheckState = CheckState.Checked;
            SClash.CheckState = CheckState.Checked;
            SSpearHandStrike.CheckState = CheckState.Checked;
            SDizzyingHaze.CheckState = CheckState.Checked;
            SGuard.CheckState = CheckState.Checked;
            SSpinningCraneKick.Value = 3;
            STouchofDeath.CheckState = CheckState.Checked;
            SBuff.CheckState = CheckState.Checked;
            SXuen.CheckState = CheckState.Checked;
            SFood.Value = 60;
            SAutoTarget.CheckState = CheckState.Unchecked;
            SMoveToTarget.CheckState = CheckState.Checked;

            SPending.Value = 1000;

            SLifeCocoon.Value = 30;
            SEnvelopingMist.Value = 80;
            SSurgingMist.Value = 60;
            SRenewingMist.Value = 95;
            SSoothingMist.Value = 80;
            SUplift.Value = 95;
            SUpliftMinUnit.Value = 3;
            SChiBurstHeal.Value = 95;
            SChiBurstHealUnit.Value = 3;
            SZenSphere.Value = 95;
            SChiWave.Value = 95;
            SChiTorpedoUnit.Value = 3;
            SChiTorpedo.Value = 95;
            SSpinCraneKickHealUnit.Value = 3;
            SSpinCraneKickHeal.Value = 95;
            SJabChi.Value = 0;
            SThunderFocusUnit.Value = 3;
            SSummonJadeSerpentStatue.CheckState = CheckState.Checked;

            SFortifyingBrew.Value = 40;
            SAvertHamUnit.Value = 3;
            SAvertHam.Value = 60;
            SZenMedUnit.Value = 3;
            SZenMed.Value = 40;
            SRevive.Value = 60;
            SReviveUnit.Value = 3;

            SDetox.CheckState = CheckState.Checked;
            SDetoxDebuffNumber.Value = 3;
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://tuanha2000vn.wordpress.com/");
        }


        /// <summary>
        /// Checkbox start here
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //private void SLifeCocoon_ValueChanged(object sender, EventArgs e)
        //{
        //    THSettings.Instance.SLifeCocoon = (int)SLifeCocoon.Value;
        //}
        //private void SRoll_CheckedChanged(object sender, EventArgs e)
        //{
        //    THSettings.Instance.SRoll = SRoll.Checked;
        //}
        private void SStrafleLeft_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (SStrafleLeft.SelectedIndex == i)
                {
                    THSettings.Instance.SStrafleLeft = i;
                }
            }
        }

        private void SForward_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (SForward.SelectedIndex == i)
                {
                    THSettings.Instance.SForward = i;
                }
            }
        }

        private void SStrafleRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (SStrafleRight.SelectedIndex == i)
                {
                    THSettings.Instance.SStrafleRight = i;
                }
            }
        }

        private void STurnRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (STurnRight.SelectedIndex == i)
                {
                    THSettings.Instance.STurnRight = i;
                }
            }
        }

        private void SBackward_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (SBackward.SelectedIndex == i)
                {
                    THSettings.Instance.SBackward = i;
                }
            }
        }

        private void STurnLeft_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (STurnLeft.SelectedIndex == i)
                {
                    THSettings.Instance.STurnLeft = i;
                }
            }
        }

        private void SRoll_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SRoll = SRoll.Checked;
        }

        private void SFSK_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SFSK = SFSK.Checked;
        }

        private void SProvoke_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SProvoke = SProvoke.Checked;
        }

        private void SSummonBlackOxStatue_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSummonBlackOxStatue = SSummonBlackOxStatue.Checked;
        }

        private void SLeeroftheOx_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SLeeroftheOx = SLeeroftheOx.Checked;
        }

        private void SClash_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SClash = SClash.Checked;
        }

        private void SSpearHandStrike_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSpearHandStrike = SSpearHandStrike.Checked;
        }

        private void SDizzyingHaze_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SDizzyingHaze = SDizzyingHaze.Checked;
        }

        private void SGuard_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGuard = SGuard.Checked;
        }

        private void SSpinningCraneKick_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSpinningCraneKick = (int) SSpinningCraneKick.Value;
        }

        private void SXuen_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SXuen = SXuen.Checked;
        }

        private void STouchofDeath_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.STouchofDeath = STouchofDeath.Checked;
        }

        private void SBuff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SBuff = SBuff.Checked;
        }

        private void SLifeCocoon_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SLifeCocoon = (int) SLifeCocoon.Value;
        }

        private void SEnvelopingMist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SEnvelopingMist = (int) SEnvelopingMist.Value;
        }

        private void SSurgingMist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSurgingMist = (int) SSurgingMist.Value;
        }

        private void SRenewingMist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SRenewingMist = (int) SRenewingMist.Value;
        }

        private void SSoothingMist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSoothingMist = (int) SSoothingMist.Value;
        }

        private void SUpliftMinUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SUpliftMinUnit = (int) SUpliftMinUnit.Value;
        }

        private void SUplift_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SUplift = (int) SUplift.Value;
        }

        private void SChiBurstHealUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SChiBurstHealUnit = (int) SChiBurstHealUnit.Value;
        }

        private void SChiBurstHeal_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SChiBurstHeal = (int) SChiBurstHeal.Value;
        }

        private void SChiTorpedoUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SChiTorpedoUnit = (int) SChiTorpedoUnit.Value;
        }

        private void SChiTorpedo_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SChiTorpedo = (int) SChiTorpedo.Value;
        }

        private void SSpinCraneKickHealUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSpinCraneKickHealUnit = (int) SSpinCraneKickHealUnit.Value;
        }

        private void SSpinCraneKickHeal_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSpinCraneKickHeal = (int) SSpinCraneKickHeal.Value;
        }

        private void SZenSphere_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SZenSphere = (int) SZenSphere.Value;
        }

        private void SChiWave_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SChiWave = (int) SChiWave.Value;
        }

        private void SJabChi_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SJabChi = (int) SJabChi.Value;
        }

        private void SThunderFocusUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SThunderFocusUnit = (int) SThunderFocusUnit.Value;
        }


        private void SSummonJadeSerpentStatue_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SSummonJadeSerpentStatue = SSummonJadeSerpentStatue.Checked;
        }

        private void SPending_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SPending = (int) SPending.Value;
        }

        private void SFood_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SFood = (int) SFood.Value;
        }

        private void SAutoTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SAutoTarget = SAutoTarget.Checked;
        }

        private void SMoveToTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SMoveToTarget = SMoveToTarget.Checked;
        }

        private void SFortifyingBrew_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SFortifyingBrew = (int) SFortifyingBrew.Value;
        }

        private void SAvertHamUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SAvertHamUnit = (int) SAvertHamUnit.Value;
        }

        private void SAvertHam_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SAvertHam = (int) SAvertHam.Value;
        }

        private void SZenMedUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SZenMedUnit = (int) SZenMedUnit.Value;
        }

        private void SZenMed_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SZenMed = (int) SZenMed.Value;
        }

        private void SReviveUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SRevivalUnit = (int) SReviveUnit.Value;
        }

        private void SRevive_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SRevival = (int) SRevive.Value;
        }

        private void SDetox_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SDetox = SDetox.Checked;
        }

        private void SDetoxDebuffNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SDetoxDebuffNumber = (int) SDetoxDebuffNumber.Value;
        }

        private void SGroup1_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup1 = SGroup1.Checked;
        }

        private void SGroup2_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup2 = SGroup2.Checked;
        }

        private void SGroup3_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup3 = SGroup3.Checked;
        }

        private void SGroup4_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup4 = SGroup4.Checked;
        }

        private void SGroup5_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup5 = SGroup5.Checked;
        }

        private void SGroup6_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup6 = SGroup6.Checked;
        }

        private void SGroup7_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup7 = SGroup7.Checked;
        }

        private void SGroup8_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SGroup8 = SGroup8.Checked;
        }
    }
}